package com.dyp.asyncdemo;

import com.dyp.asyncdemo.service.TestService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableAsync;

@SpringBootApplication
public class AsyncDemoApplication implements CommandLineRunner {

	private final Logger log = LoggerFactory.getLogger(AsyncDemoApplication.class);

	public static void main(String[] args) {
		SpringApplication.run(AsyncDemoApplication.class, args);
	}

	@Autowired
	TestService testService;

	@Override
	public void run(String... args) throws Exception {
		System.out.println("==================start==================");
		testService.asyncTask();
		System.out.println("==================end==================");
	}
}
